package com.victor.modular.system.transfer;


import com.victor.common.exception.ValidationException;
import com.victor.core.util.Excel;
import com.victor.core.util.UtilTrans;
import lombok.Data;
import org.hibernate.validator.constraints.NotEmpty;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;


/**
 * ExhibitorImport
 */
@Data
public class AudienceImport {
    private static final long serialVersionUID = 1L;

    public void setValues(String[] values) throws Exception {
        assertEquals(values, 28);
        this.sex =UtilTrans.transNullToString(values[0]);
        this.name = UtilTrans.transNullToString(values[1]);
        this.companyCn = UtilTrans.transNullToString(values[2]);

        this.companyEn = UtilTrans.transNullToString(values[3]);
        this.position = UtilTrans.transNullToString(values[4]);
        this.department = UtilTrans.transNullToString(values[5]);
        this.country = UtilTrans.transNullToString(values[6]);
        this.province = UtilTrans.transNullToString(values[7]);
        this.city = UtilTrans.transNullToString(values[8]);
        this.address = UtilTrans.transNullToString(values[9]);
        this.postcode = UtilTrans.transNullToString(values[10]);
        this.seatCountryCode = UtilTrans.transNullToString(values[11]);
        this.seatAreaCode = UtilTrans.transNullToString(values[12]);
        this.seatcode = UtilTrans.transNullToString(values[13]);
        this.faxCountryCode = UtilTrans.transNullToString(values[14]);
        this.faxAreaCode = UtilTrans.transNullToString(values[15]);
        this.faxcode = UtilTrans.transNullToString(values[16]);
        this.phoneAreaCode = UtilTrans.transNullToString(values[17]);
        this.phone = UtilTrans.transNullToString(values[18]);
        this.email = UtilTrans.transNullToString(values[19]);
        this.website = UtilTrans.transNullToString(values[20]);

        this.businessType1 = UtilTrans.transNullToString(values[21]);
        this.businessType2 = UtilTrans.transNullToString(values[22]);
        this.businessType3 = UtilTrans.transNullToString(values[23]);
        this.industryType = UtilTrans.transNullToString(values[24]);
        this.property = UtilTrans.transNullToString(values[25]);
        this.partakeActivity = UtilTrans.transNullToString(values[26]);
        this.remark = UtilTrans.transNullToString(values[27]);
    }

    public void assertEquals(String[] values, int size) throws ValidationException {
        if (values.length != size) {
            throw new ValidationException("配置文件提供" + values.length + "个字段" + ",而导入数据库需要提供" + size + "个字段");
        }
    }
    /**
     * 性别 1男/2女
     */
    @Excel(exportName = "姓别", exportFieldWidth = 18, exportConvertSign = 0, importConvertSign = 0)
    private String sex;
    //姓名*
    @Excel(exportName = "姓名", exportFieldWidth = 18, exportConvertSign = 0, importConvertSign = 0)
    private String name;
    /**
     * 公司名_中文
     */
    @NotEmpty(message = "公司中文名* 不能为空")
    @Excel(exportName = "公司中文名*", exportFieldWidth = 18, exportConvertSign = 0, importConvertSign = 0)
    private String companyCn;
    /**
     * 公司名_英文
     */
    @Pattern(regexp = "^[^\\u4E00-\\u9FA5]*$", message = "公司英文名不允许为中文")
    @Excel(exportName = "公司英文名", exportFieldWidth = 18, exportConvertSign = 0, importConvertSign = 0)
    private String companyEn;
    /**
     * 职位
     */
    @Excel(exportName = "职位", exportFieldWidth = 18, exportConvertSign = 0, importConvertSign = 0)
    private String position;
    /**
     * 部门
     */
    @Excel(exportName = "部门", exportFieldWidth = 18, exportConvertSign = 0, importConvertSign = 0)
    private String department;
    /**
     * 国家
     */
    @Excel(exportName = "国家", exportFieldWidth = 18, exportConvertSign = 0, importConvertSign = 0)
    private String country;
    /**
     * 省
     */
    @Excel(exportName = "省", exportFieldWidth = 18, exportConvertSign = 0, importConvertSign = 0)
    private String province;
    /**
     * 市
     */
    @Excel(exportName = "市", exportFieldWidth = 18, exportConvertSign = 0, importConvertSign = 0)
    private String city;
    /**
     * 详细地址
     */
    @Excel(exportName = "详细地址", exportFieldWidth = 18, exportConvertSign = 0, importConvertSign = 0)
    private String address;
    /**
     * 邮编
     */
    @Excel(exportName = "邮编", exportFieldWidth = 18, exportConvertSign = 0, importConvertSign = 0)
    private String postcode;
    /**
     * 座机国家区号
     */
    @Excel(exportName = "座机国家区号", exportFieldWidth = 18, exportConvertSign = 0, importConvertSign = 0)
    private String seatCountryCode;
    /**
     * 座机地区号
     */
    @Excel(exportName = "座机地区号", exportFieldWidth = 18, exportConvertSign = 0, importConvertSign = 0)
    private String seatAreaCode;
    /**
     * 座机号
     */
    @Excel(exportName = "座机号", exportFieldWidth = 18, exportConvertSign = 0, importConvertSign = 0)
    private String seatcode;
    /**
     * 传真国家区号
     */
    @Excel(exportName = "传真国家区号", exportFieldWidth = 18, exportConvertSign = 0, importConvertSign = 0)
    private String faxCountryCode;
    /**
     * 传真地区号
     */
    @Excel(exportName = "传真地区号", exportFieldWidth = 18, exportConvertSign = 0, importConvertSign = 0)
    private String faxAreaCode;
    /**
     * 传真号
     */
    @Excel(exportName = "传真号", exportFieldWidth = 18, exportConvertSign = 0, importConvertSign = 0)
    private String faxcode;
    /**
     * 手机区号
     */
    @Excel(exportName = "手机区号", exportFieldWidth = 18, exportConvertSign = 0, importConvertSign = 0)
    private String phoneAreaCode;

    //电话号
    @Excel(exportName = "电话号", exportFieldWidth = 18, exportConvertSign = 0, importConvertSign = 0)
    private String phone;

    //邮箱
//    @Pattern(regexp = "^[a-zA-Z0-9_-]+@[a-zA-Z0-9_-]+(\\.[a-zA-Z0-9_-]+)+$", message = "邮箱格式错误")
    @Excel(exportName = "邮箱", exportFieldWidth = 18, exportConvertSign = 0, importConvertSign = 0)
    private String email;
    /**
     * 网站
     */
    @Excel(exportName = "网站", exportFieldWidth = 18, exportConvertSign = 0, importConvertSign = 0)
    private String website;
    /**
     * 公司商业性质1
     */
    @NotEmpty(message = "公司商业性质1* 不能为空")
    @Excel(exportName = "公司商业性质1*", exportFieldWidth = 18, exportConvertSign = 0, importConvertSign = 0)
    private String businessType1;
    /**
     * 公司商业性质2
     */
    @Excel(exportName = "公司商业性质2", exportFieldWidth = 18, exportConvertSign = 0, importConvertSign = 0)
    private String businessType2;
    /**
     * 公司商业性质3
     */
    @Excel(exportName = "公司商业性质3", exportFieldWidth = 18, exportConvertSign = 0, importConvertSign = 0)
    private String businessType3;
    /**
     * 公司行业性质
     */
    @NotEmpty(message = "公司行业性质* 不能为空")
    @Excel(exportName = "公司行业性质*", exportFieldWidth = 18, exportConvertSign = 0, importConvertSign = 0)
    private String industryType;
    /**
     * 属性（展商/观众）
     */
    @NotEmpty(message = "客户身份* 不能为空")
    @Excel(exportName = "客户身份*", exportFieldWidth = 18, exportConvertSign = 0, importConvertSign = 0)
    private String property;

    /**
     * 参与活动
     */
    @Excel(exportName = "参与活动", exportFieldWidth = 18, exportConvertSign = 0, importConvertSign = 0)
    private String partakeActivity;

    /**
     * 备注
     */
    @Excel(exportName = "备注", exportFieldWidth = 18, exportConvertSign = 0, importConvertSign = 0)
    private String remark;

}
